package keke;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main10jinzhi {//201521123006
	public static boolean isNumeric(String str){ 
		   Pattern pattern = Pattern.compile("-?[0-9]+.?[0-9]+"); 
		   Matcher isNum = pattern.matcher(str);
		   if( !isNum.matches() ){
		       return false; 
		   } 
		   return true; 
		}
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in );
		int n=in.nextInt();
		String[] str=new String[n];
		for(int i=0;i<str.length;i++){
			str[i]=in.next();
			System.out.println(isNumeric(str[i]));
		}
		in.close();
	}
}
